import instance from "./axios";
// 返回实况天气
export const getLiveWeather = (adcode) => {
  return instance.get(
    `/weather/weatherInfo?key=0d789d0e03945bcb65461ffa70029504&city=${adcode}&extensions=base`
  );
};
// 获取天气预报
export const getWeatherForecast = (adcode) => {
  return instance.get(
    `/weather/weatherInfo?key=0d789d0e03945bcb65461ffa70029504&city=${adcode}&extensions=all`
  );
};

// 通过ip获取城市编码
export const getCitycodeByip = () => {
  return instance.get(`/ip?key=0d789d0e03945bcb65461ffa70029504`);
};

// 通过城市名字获取城市编码
export const getCitycodeByName = (cityname) => {
  return instance({
    url: "/config/district",
    method: "GET",
    params: {
      keywords: cityname,
      key: "0d789d0e03945bcb65461ffa70029504",
    },
  });
};
